﻿<div class="main">
    <form id="_form" class="form form-group-sm ui-validForm" data-validate-params="tipsStyle:'1'" data-source="@Model">
        <div class="form-group">
            <label class="control-label" for="name">菜单名称</label>
            <div class="controls">
                <input type="text" name="Name" id="Name" maxlength="30" data-validate="dataType:'*',nullMsg:'请填写菜单名称!'" class="form-control">
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group top_menu_disable">
            <label class="control-label" for="is_final">菜单类型</label>
            <div class="controls radio">
                <label class="radio-inline"><input class="ui-show-hide" showObjs=".final_box" hideObjs=".node_box" type="radio" name="IsFinal" id="IsFinal" value="1" checked>最终菜单</label>
                <label class="radio-inline"><input class="ui-show-hide" showObjs=".node_box" hideObjs=".final_box" type="radio" name="IsFinal" id="IsFinal" value="0">分类节点</label>
                <span class="help-block"></span>
            </div>
        </div>


        <div class="final_box">

            <div class="form-group">
                <label class="control-label" for="controller">命名空间</label>
                <div class="controls">
                    <input type="text" name="NameSpace" id="NameSpace" maxlength="100" class="form-control" data-validate="dataType:'*',nullMsg:'请填写命名空间!',errorMsg:'请填写正确的命名空间!',ignoreHidden:true">
                    <span class="help-block">必须填写，表示控制器在的命名空间</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label" for="controller">控制器名</label>
                <div class="controls">
                    <input type="text" name="Controller" id="Controller" maxlength="50" class="form-control" data-validate="dataType:'string',nullMsg:'请填写控制器名!',errorMsg:'请填写正确的控制器名!',ignoreHidden:true">
                    <span class="help-block">必须填写,其中Controller后缀不需要填写</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label" for="action">方法名</label>
                <div class="controls">
                    <input type="text" name="Action" id="Action" maxlength="50" class="form-control" data-validate="dataType:'string',errorMsg:'请填写正确的方法名!',ignoreHidden:true">
                    <span class="help-block">留空则默认index</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label" for="action">Area(区域)</label>
                <div class="controls">
                    <input type="text" name="Area" id="Area" maxlength="50" class="form-control" data-validate="dataType:'string',ignoreEmpty:true,errorMsg:'请填写正确的区域名称!',ignoreHidden:true">
                    <span class="help-block">如果控制器不属于任何区域，请留空</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label" for="action">插件名称</label>
                <div class="controls">
                    <input type="text" name="PluginName" id="PluginName" maxlength="50" class="form-control">
                    <span class="help-block">如果当前菜单属于插件，请填写上插件名称，否则请留空。</span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label" for="show">目标窗口</label>
                <div class="controls radio">
                    <label class="radio-inline"><input type="radio" name="Target" id="Target" value="" checked />框架内打开</label>
                    <label class="radio-inline"><input type="radio" name="Target" id="Target" value="_blank">新窗口</label>
                    <span class="help-block"></span>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label" for="ZdyUrl">自定义Url</label>
                <div class="controls">
                    <input type="text" name="ZdyUrl" id="ZdyUrl" maxlength="100" class="form-control">
                    <span class="help-block">如果设置了自定义Url，将优先使用</span>
                </div>
            </div>
        </div>

        <div class="node_box">

            <div class="form-group top_menu_disable">
                <label class="control-label" for="name">节点图标</label>
                <div class="controls">
                    <input type="text" name="Icon" id="Icon" maxlength="30" class="form-control">
                    <span class="help-block">留空则系统默认，填写Font Awesome的对应css样式即可,<a href="/incs/font-awesome/demo.html" target="blank">点击查看图标样式</a></span>
                </div>
            </div>

            <div class="form-group is_expand_box">
                <label class="control-label" for="is_expand">子级默认展开</label>
                <div class="controls radio">
                    <label class="radio-inline"><input type="radio" name="IsExpand" id="IsExpand" value="1" checked>是</label>
                    <label class="radio-inline"><input type="radio" name="IsExpand" id="IsExpand" value="0">否</label>
                    <span class="help-block">用于设置包含的子菜单的展开方式</span>
                </div>
            </div>
        </div>

        <div class="form-group hidden">
            <label class="control-label" for="show">系统菜单</label>
            <div class="controls radio">
                <label class="radio-inline"><input type="radio" name="IsSys" id="IsSys" value="1">是</label>
                <label class="radio-inline"><input type="radio" name="IsSys" id="IsSys" value="0" checked>否</label>
                <span class="help-block">系统菜单增加后不可以直接删除，只能修改为非系统字段后再删除</span>
            </div>
        </div>


        <div class="form-group">
            <label class="control-label" for="show">是否启用</label>
            <div class="controls radio">
                <label class="radio-inline"><input type="radio" name="State" id="State" value="1" checked />是</label>
                <label class="radio-inline"><input type="radio" name="State" id="State" value="0">否</label>
                <span class="help-block"></span>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label" for="xuhao">序号</label>
            <div class="controls">
                <input type="text" name="Xuhao" id="Xuhao" maxlength="5" value="1" class="ui-queryString form-control form-control-xs" data-validate="dataType:'numeric',ignoreHidden:true" onblur="if(!IsNum(this.value)){this.value='1'}">
                <span class="help-block"></span>
            </div>
        </div>

        <div class="submit-footerbar">
            <label class="control-label"></label>
            <div class="controls">
                <input type="hidden" name="SysNode" id="SysNode" value="" />
                <input type="hidden" name="Id" id="Id" value="0" />
                <input type="hidden" name="Level" id="Level" value="0" />
                <input type="hidden" name="ParentId" id="ParentId" value="0" />
                <input type="hidden" name="Guid" id="Guid" value="@ViewBag.Guid" />
                <input type="hidden" name="ParentGuid" id="ParentGuid" value="@Request.QueryString["parentGuid"]" />
                <button type="button" class="btn btn-sm  btn-primary ui-pagePost" data-custom-params="url:'@Url.ActionUrl()',callBack:'PostRefreshBack'">提交</button>
                <button type="button" class="btn btn-sm btn-default ui-closeDialog">关闭</button>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    var parentId ="@Request.QueryString["parentId"]";

    function SetTopMenu(parentGuid) {
        if (parentId == "0" || parentId == "") {
            $("input[name='IsFinal']").eq(1).click();
            $(".is_expand_box").hide();
            $(".top_menu_disable").hide();
        }
        else
        {
            $("#ParentId").val(parentId);
        }
    }

    var id = Request("id");
    if (IsInt(id)) {
        $("#_form").FormBind({ dataSourceFrom: "attr" });
        $("input[name='IsFinal']").attr("disabled", "disabled");
        parentId = $("#ParentId").val();
        var isFinal = $("input[name='IsFinal']:checked").val();
        SetTopMenu(parentId);
    }
    else {
        SetTopMenu(parentId);
    }
    var currentLevel = 0;
    if (Request("parent_level") != "") {
        currentLevel = parseInt(Request("parent_level")) + 1;
    }
    else {
        currentLevel = parseInt(Request("level"));
    }
    if (currentLevel > 2) {
        $(".box_icon_class").hide();
    }

</script>
